﻿(function () {
    'use strict';
    
    var app = angular.module('app', [
        'ngAnimate',
        'ngSanitize',

        'ui.router',
        'ui.bootstrap',
        'ui.jq',
        'ct.ui.router.extras.dsr',
        'ct.ui.router.extras.sticky',
        'abp'
    ]);

    //Configuration for Angular UI routing.
    app.config([
        '$stateProvider', '$urlRouterProvider',
        function($stateProvider, $urlRouterProvider) {
            /*$urlRouterProvider.otherwise('/');
*/
            $urlRouterProvider.otherwise("/main/tenants");

            $stateProvider
                .state("main",
                {
                    abstract: true,
                    url: "/main",
                    templateUrl: "/App/Main/views/maintab.cshtml"
                })
                .state("main.tenants",
                {
                    url: "/tenants",
                    menu: 'Tenants',
                    deepStateRedirect: true,
                    sticky: true,
                    views:{
                    'Tenants': {
                        templateUrl: "/App/Main/views/tenants/index.cshtml",
                        }
                    }
        })
                    .state("main.home",
                    {
                        url: "/home",
                        menu: 'Home',
                        deepStateRedirect: true,
                        sticky: true,
                        views: {
                            'Home': {
                                templateUrl: "/App/Main/views/home/home.cshtml",
                            }
                        }
                    })
                    .state("main.about",
                    {
                        url: "/about",
                        menu: 'About',
                        deepStateRedirect: true,
                        sticky: true,
                        views: {
                            'About': {
                                templateUrl: "/App/Main/views/about/about.cshtml",
                            }
                        }
                    });


            /*if (abp.auth.hasPermission('Pages.Tenants')) {
                $stateProvider
                    .state('tenants', {
                        url: '/tenants',
                        templateUrl: '/App/Main/views/tenants/index.cshtml',
                        menu: 'Tenants' //Matches to name of 'Tenants' menu in OneDemoNavigationProvider
                    });
                $urlRouterProvider.otherwise('/tenants');
            }

            $stateProvider
                .state('home', {
                    url: '/',
                    templateUrl: '/App/Main/views/home/home.cshtml',
                    menu: 'Home' //Matches to name of 'Home' menu in OneDemoNavigationProvider
                })
                .state('about', {
                    url: '/about',
                    templateUrl: '/App/Main/views/about/about.cshtml',
                    menu: 'About' //Matches to name of 'About' menu in OneDemoNavigationProvider
                });

*/
        }
    ]);
})();